
using System;
using System.Runtime.InteropServices;

namespace Fmod 
{ 
	public class FmodFunction
{
	public FmodFunction()
		{ }
	
	#region WINMM
		[DllImport ("coredll.dll", EntryPoint="waveOutGetVolume", SetLastError=true)]
		public static extern int waveOutGetVolume(IntPtr uDeviceID, ref int pdwVolume);
		[DllImport ("coredll.dll", EntryPoint="waveOutSetVolume", SetLastError=true)]
		public static extern int waveOutSetVolume(IntPtr uDeviceID, int dwVolume);
	#endregion

	#region FMUSIC
		[DllImport("fmodce", EntryPoint="FMUSIC_LoadSong", SetLastError = true)]
		public static extern IntPtr FMUSIC_LoadSong(IntPtr name_or_data);
		[DllImport("fmodce", EntryPoint = "FMUSIC_PlaySong", SetLastError = true)]
		public static extern sbyte FMUSIC_PlaySong(IntPtr mod);
		[DllImport("fmodce", EntryPoint = "FMUSIC_StopAllSongs", SetLastError = true)]
		public static extern void FMUSIC_StopAllSongs();
		[DllImport("fmodce", EntryPoint = "FMUSIC_SetPaused", SetLastError = true)]
		public static extern sbyte FMUSIC_SetPaused(IntPtr mod, sbyte pause);
		[DllImport("fmodce", EntryPoint = "FMUSIC_IsPlaying", SetLastError = true)]
		public static extern sbyte FMUSIC_IsPlaying(IntPtr mod);
		[DllImport("fmodce", EntryPoint = "FMUSIC_FreeSong", SetLastError = true)]
		public static extern sbyte FMUSIC_FreeSong(IntPtr mod);
		[DllImport("fmodce", EntryPoint = "FMUSIC_GetNumOrders", SetLastError = true)]
		public static extern int FMUSIC_GetNumOrders(IntPtr mod);	
		[DllImport("fmodce", EntryPoint = "FMUSIC_GetOrder", SetLastError = true)]
		public static extern int FMUSIC_GetOrder(IntPtr mod);
		[DllImport("fmodce", EntryPoint = "FMUSIC_SetOrder", SetLastError = true)]
		public static extern sbyte FMUSIC_SetOrder(IntPtr mod, int order);
		[DllImport("fmodce", EntryPoint = "FMUSIC_GetNumPatterns", SetLastError = true)]
		public static extern int FMUSIC_GetNumPatterns(IntPtr mod);
		[DllImport("fmodce", EntryPoint = "FMUSIC_GetPattern", SetLastError = true)]
		public static extern int FMUSIC_GetPattern(IntPtr mod);
		[DllImport("fmodce", EntryPoint = "FMUSIC_GetPatternLength", SetLastError = true)]
		public static extern int FMUSIC_GetPatternLength(IntPtr mod, int orderno);
		[DllImport("fmodce", EntryPoint = "FMUSIC_GetRow", SetLastError = true)]
		public static extern int FMUSIC_GetRow(IntPtr mod);
		[DllImport("fmodce", EntryPoint = "FMUSIC_GetTime", SetLastError = true)]
		public static extern int FMUSIC_GetTime(IntPtr mod);
		[DllImport("fmodce", EntryPoint = "FMUSIC_GetMasterVolume", SetLastError = true)]
		public static extern int FMUSIC_GetMasterVolume(IntPtr mod);
		[DllImport("fmodce", EntryPoint = "FMUSIC_GetBPM", SetLastError = true)]
		public static extern int FMUSIC_GetBPM(IntPtr mod);
		[DllImport("fmodce", EntryPoint = "FMUSIC_GetNumChannels", SetLastError = true)]
		public static extern int FMUSIC_GetNumChannels(IntPtr mod);
		[DllImport("fmodce", EntryPoint = "FMUSIC_GetNumInstruments", SetLastError = true)]
		public static extern int FMUSIC_GetNumInstruments(IntPtr mod);
		[DllImport("fmodce", EntryPoint = "FMUSIC_GetNumSamples", SetLastError = true)]
		public static extern int FMUSIC_GetNumSamples(IntPtr mod);
		[DllImport("fmodce", EntryPoint = "FMUSIC_SetMasterVolume", SetLastError = true)]
		public static extern sbyte FMUSIC_SetMasterVolume(IntPtr mod, int vol);
		[DllImport("fmodce", EntryPoint = "FMUSIC_SetLooping", SetLastError = true)]
		public static extern sbyte FMUSIC_SetLooping(IntPtr mod, sbyte looping);
		[DllImport("fmodce", EntryPoint = "FMUSIC_GetName", SetLastError = true, CharSet = CharSet.Auto)]
		public static extern IntPtr FMUSIC_GetName(IntPtr mod);
	#endregion

	#region FSOUND
		[DllImport("fmodce", EntryPoint = "FSOUND_Close", SetLastError = true)]
		public static extern void FSOUND_Close();
		[DllImport("fmodce", EntryPoint = "FSOUND_Init", SetLastError = true)]
		public static extern sbyte FSOUND_Init(int mixrate, int maxsoftwarechannels, uint flags);
		[DllImport("fmodce", EntryPoint = "FSOUND_Stream_Close", SetLastError = true)]
		public static extern sbyte FSOUND_Stream_Close(IntPtr ptr);
		[DllImport("fmodce", EntryPoint = "FSOUND_Stream_Open", SetLastError = true)]
		public static extern IntPtr FSOUND_Stream_Open(IntPtr name_or_data, uint mode, int offset, int length); 
		[DllImport("fmodce", EntryPoint = "FSOUND_Stream_Play", SetLastError = true)]
		public static extern int FSOUND_Stream_Play(int channel, IntPtr stream);
		[DllImport("fmodce", EntryPoint = "FSOUND_Stream_Stop", SetLastError = true)]
		public static extern sbyte FSOUND_Stream_Stop(IntPtr stream); 
		[DllImport("fmodce", EntryPoint = "FSOUND_SetVolume", SetLastError = true)]
		public static extern sbyte FSOUND_SetVolume(int channel, int volumn);
		[DllImport("fmodce", EntryPoint = "FSOUND_SetSFXMasterVolume", SetLastError = true)]
		public static extern sbyte FSOUND_SetSFXMasterVolume(int volumn);
		[DllImport("fmodce", EntryPoint = "FSOUND_SetMixer", SetLastError = true)]
	 	public static extern sbyte FSOUND_SetMixer(Enums.FSOUND_MIXERTYPES mixer);
	    [DllImport("fmodce", EntryPoint = "FSOUND_SetOutput", SetLastError = true)]
	    public static extern sbyte FSOUND_SetOutput(Enums.FSOUND_OUTPUTTYPES outputtype);
		[DllImport("fmodce", EntryPoint = "FSOUND_SetBufferSize", SetLastError = true)]
		public static extern sbyte FSOUND_SetBufferSize(int len_ms);
		[DllImport("fmodce", EntryPoint = "FSOUND_SetDriver", SetLastError = true)]
		public static extern sbyte FSOUND_SetDriver(int driver);
	    [DllImport("fmodce", EntryPoint = "FSOUND_SetHWND", SetLastError = true)]
	    public static extern sbyte FSOUND_SetHWND(IntPtr hwnd);
	    [DllImport("fmodce", EntryPoint = "FSOUND_Stream_Create", SetLastError = true)]
		public static extern IntPtr FSOUND_Stream_Create(IntPtr FSOUND_STREAMCALLBACK_callback, int lenbytes, Enums.FSOUND_MODES mode, int samplerate, IntPtr userdata);
		[DllImport("fmodce", EntryPoint = "FSOUND_Stream_CreateDSP", SetLastError = true)]
		public static extern IntPtr FSOUND_Stream_CreateDSP(IntPtr FSOUND_STREAM_stream, IntPtr FSOUND_DSPCALLBACK_callback, int priority, IntPtr userdata);
		[DllImport("fmodce", EntryPoint = "FSOUND_Stream_GetLength", SetLastError = true)]
		public static extern int FSOUND_Stream_GetLength(IntPtr FSOUND_STREAM_stream);
		[DllImport("fmodce", EntryPoint = "FSOUND_Stream_GetLengthMs", SetLastError = true)]
		public static extern int FSOUND_Stream_GetLengthMs(IntPtr FSOUND_STREAM_stream);
		[DllImport("fmodce", EntryPoint = "FSOUND_Stream_GetMode", SetLastError = true)]
		public static extern uint FSOUND_Stream_GetMode(IntPtr FSOUND_STREAM_stream);
		[DllImport("fmodce", EntryPoint = "FSOUND_Stream_GetPosition", SetLastError = true)]
		public static extern uint FSOUND_Stream_GetPosition(IntPtr FSOUND_STREAM_stream);
		[DllImport("fmodce", EntryPoint = "FSOUND_Stream_GetTime", SetLastError = true)]
		public static extern int FSOUND_Stream_GetTime(IntPtr FSOUND_STREAM_stream);
		[DllImport("fmodce", EntryPoint = "FSOUND_Stream_PlayEx", SetLastError = true)]
		public static extern int FSOUND_Stream_PlayEx(int channel, IntPtr FSOUND_STREAM_stream, IntPtr FSOUND_DSPUNIT_dspunit, sbyte paused);
		[DllImport("fmodce", EntryPoint = "FSOUND_Stream_SetBufferSize", SetLastError = true)]
		public static extern sbyte FSOUND_Stream_SetBufferSize(int ms);
		[DllImport("fmodce", EntryPoint = "FSOUND_Stream_SetMode", SetLastError = true)]
		public static extern sbyte FSOUND_Stream_SetMode(IntPtr FSOUND_STREAM_stream, Enums.FSOUND_MODES mode);
		[DllImport("fmodce", EntryPoint = "FSOUND_Stream_SetPosition", SetLastError = true)]
		public static extern sbyte FSOUND_Stream_SetPosition(IntPtr FSOUND_STREAM_stream, uint position);
		[DllImport("fmodce", EntryPoint = "FSOUND_Stream_SetTime", SetLastError = true)]
		public static extern sbyte FSOUND_Stream_SetTime(IntPtr FSOUND_STREAM_stream, int ms);
	    [DllImport("fmodce")]
	    public static extern IntPtr FSOUND_DSP_Create(IntPtr FSOUND_DSPCALLBACK, Enums.FSOUND_DSP_PRIORITIES priority, IntPtr userdata);
		[DllImport("fmodce")]
		public static extern void FSOUND_DSP_Free(IntPtr FSOUND_DSPUNIT);
		[DllImport("fmodce")]
		public static extern void FSOUND_DSP_SetActive(IntPtr FSOUND_DSPUNIT, sbyte active);
		[DllImport("fmodce")]
		public static extern sbyte FSOUND_DSP_GetActive(IntPtr FSOUND_DSPUNIT); 
		[DllImport("fmodce")]
		public static extern int FSOUND_DSP_GetBufferLength();
		[DllImport("fmodce")]
		public static extern int FSOUND_DSP_GetBufferLengthTotal();
		[DllImport("fmodce")]
		public static extern IntPtr FSOUND_DSP_GetSpectrum();
		[DllImport("fmodce")]
		public static extern sbyte FSOUND_DSP_MixBuffers(IntPtr destbuffer, IntPtr srcbuffer, int len, int freq, int vol, int pan, Enums.FSOUND_MODES mode);
		[DllImport("fmodce")]
		public static extern IntPtr FSOUND_DSP_GetSFXUnit();
		[DllImport("fmodce")]
		public static extern IntPtr FSOUND_DSP_GetFFTUnit();
		[DllImport("fmodce")]
		public static extern sbyte FSOUND_FX_Disable(int channel);
    	[DllImport("fmodce")]
		public static extern int FSOUND_FX_Enable(int channel, Enums.FSOUND_FX_MODES fxtype);
		[DllImport("fmodce")]
		public static extern sbyte FSOUND_FX_SetChorus(int fxid, float WetDryMix, float Depth, float Feedback, float Frequency, int Waveform, float Delay, int Phase);
		[DllImport("fmodce")]
		public static extern sbyte FSOUND_FX_SetCompressor(int fxid, float Gain, float Attack, float Release, float Threshold, float Ratio, float Predelay);
		[DllImport("fmodce")]
		public static extern sbyte FSOUND_FX_SetDistortion(int fxid, float Gain, float Edge, float PostEQCenterFrequency, float PostEQBandwidth, float PreLowpassCutoff);
		[DllImport("fmodce")]
		public static extern sbyte FSOUND_FX_SetEcho(int fxid, float WetDryMix, float Feedback, float LeftDelay, float RightDelay, int PanDelay);
		[DllImport("fmodce")]
		public static extern sbyte FSOUND_FX_SetFlanger(int fxid, float WetDryMix, float Depth, float Feedback, float Frequency, int Waveform, float Delay, int Phase);
		[DllImport("fmodce")]
		public static extern sbyte FSOUND_FX_SetGargle(int fxid, int RateHz, int WaveShape);
		[DllImport("fmodce")]
		public static extern sbyte FSOUND_FX_SetI3DL2Reverb(int fxid, int Room, int RoomHF, float RoomRolloffFactor, float DecayTime, float DecayHFRatio, int Reflections, float ReflectionsDelay, int Reverb, float ReverbDelay, float Diffusion, float Density, float HFReference);
		[DllImport("fmodce")]
		public static extern sbyte FSOUND_FX_SetParamEQ(int fxid, float Center, float Bandwidth, float Gain);
		[DllImport("fmodce")]
		public static extern sbyte FSOUND_FX_SetWavesReverb(int fxid, float InGain, float ReverbMix, float ReverbTime, float HighFreqRTRatio);
		[DllImport("fmodce")]
		public static extern int FSOUND_PlaySound(int channel, IntPtr FSOUND_SAMPLE);
		[DllImport("fmodce")]
		public static extern int FSOUND_PlaySoundEx(int channel, IntPtr FSOUND_SAMPLE, IntPtr FSOUND_DSPUNIT, sbyte startpaused);
		[DllImport("fmodce")]
		public static extern sbyte FSOUND_StopSound(int channel);
		[DllImport("fmodce")]
		public static extern sbyte FSOUND_SetFrequency(int channel, int freq);
		[DllImport("fmodce")]
		public static extern sbyte FSOUND_SetLevels(int channel, int frontleft, int center, int frontright, int backleft, int backright, int lfe);
    	[DllImport("fmodce")]
		public static extern sbyte FSOUND_SetLoopMode(int channel, Enums.FSOUND_MODES loopmode);
		[DllImport("fmodce")]
		public static extern sbyte FSOUND_SetMute(int channel, sbyte mute);
		[DllImport("fmodce")]
		public static extern sbyte FSOUND_SetPan(int channel, int pan);
     	[DllImport("fmodce")]
		public static extern sbyte FSOUND_SetPaused(int channel, sbyte paused);
		[DllImport("fmodce")]
		public static extern sbyte FSOUND_SetPriority(int channel, int priority);
		[DllImport("fmodce")]
		public static extern sbyte FSOUND_SetReserved(int channel, sbyte reserved);
		[DllImport("fmodce")]
		public static extern sbyte FSOUND_SetSurround(int channel, sbyte surround);
		[DllImport("fmodce")]
		public static extern sbyte FSOUND_SetVolumeAbsolute(int channel, int vol);
		[DllImport("fmodce")]
		public static extern int FSOUND_GetVolume(int channel);
		[DllImport("fmodce")]
		public static extern int FSOUND_GetAmplitude(int channel);
		[DllImport("fmodce")]
		public static extern sbyte FSOUND_3D_SetAttributes(int channel, ref float F_FLOAT_API_pos, ref float F_FLOAT_API_vel);
		[DllImport("fmodce")]
		public static extern sbyte FSOUND_3D_SetMinMaxDistance(int channel, float F_FLOAT_API_min, float F_FLOAT_API_max);
        [DllImport("fmodce")]
		public static extern sbyte FSOUND_SetCurrentPosition(int channel, uint pos);
		[DllImport("fmodce")]
		public static extern int FSOUND_GetCurrentPosition(int channel);
		[DllImport("fmodce")]
		public static extern IntPtr FSOUND_GetCurrentSample(int channel);
		[DllImport("fmodce")]
		public static extern sbyte FSOUND_GetCurrentLevels(int channel, ref float F_FLOAT_API_l, ref float F_FLOAT_API_r);
		[DllImport("fmodce")]
		public static extern int FSOUND_GetFrequency(int channel);
		[DllImport("fmodce")]
		public static extern uint FSOUND_GetLoopMode(int channel);
		[DllImport("fmodce")]
		public static extern int FSOUND_GetMixer();
		[DllImport("fmodce")]
		public static extern sbyte FSOUND_GetMute(int channel);
		[DllImport("fmodce")]
		public static extern int FSOUND_GetNumSubChannels(int channel);
		[DllImport("fmodce")]
		public static extern int FSOUND_GetPan(int channel);
		[DllImport("fmodce")]
		public static extern sbyte FSOUND_GetPaused(int channel);
		[DllImport("fmodce")]
		public static extern int FSOUND_GetPriority(int channel);
		[DllImport("fmodce")]
		public static extern sbyte FSOUND_GetReserved(int channel);
		[DllImport("fmodce")]
		public static extern sbyte FSOUND_GetSubChannel(int channel, int subchannel);
    	[DllImport("fmodce")]
		public static extern sbyte FSOUND_GetSurround(int channel);
		[DllImport("fmodce")]
		public static extern sbyte FSOUND_IsPlaying(int channel);
		[DllImport("fmodce")]
		public static extern sbyte FSOUND_3D_GetAttributes(int channel, ref float F_FLOAT_API_pos, ref float F_FLOAT_API_vel);
		[DllImport("fmodce")]
		public static extern sbyte FSOUND_3D_GetMinMaxDistance(int channel, ref float F_FLOAT_API_mindistance, ref float F_FLOAT_API_maxdistance);
		[DllImport("fmodce")]
		public static extern float FSOUND_GetCPUUsage();
		[DllImport("fmodce")]
		public static extern int FSOUND_GetChannelsPlaying();
		[DllImport("fmodce")]
		public static extern int FSOUND_GetDriver();
		[DllImport("fmodce")]
		public static extern sbyte FSOUND_GetDriverCaps(int id, ref uint caps);
		[DllImport("fmodce")]
		public static extern string FSOUND_GetDriverName(int id);
		[DllImport("fmodce")]
		public static extern int FSOUND_GetError();
		[DllImport("fmodce")]
		public static extern int FSOUND_GetMaxSamples();
		[DllImport("fmodce")]
		public static extern int FSOUND_GetMaxChannels();
		[DllImport("fmodce")]
		public static extern void FSOUND_GetMemoryStats(ref uint currentalloced, ref uint maxalloced);
		[DllImport("fmodce")]
		public static extern int FSOUND_GetNumDrivers();
		[DllImport("fmodce")]
		public static extern sbyte FSOUND_GetNumHWChannels(ref int num2d, ref int num3d, ref int total);
		[DllImport("fmodce")]
		public static extern Enums.FSOUND_OUTPUTTYPES FSOUND_GetOutput();
		[DllImport("fmodce")]
		public static extern IntPtr FSOUND_GetOutputHandle();
		[DllImport("fmodce")]
		public static extern int FSOUND_GetOutputRate();
		[DllImport("fmodce")]
		public static extern int FSOUND_GetSFXMasterVolume();
		[DllImport("fmodce")]
		public static extern float FSOUND_GetVersion();
		[DllImport("fmodce")]
		public static extern int FSOUND_Record_GetDriver();
		[DllImport("fmodce")]
		public static extern string FSOUND_Record_GetDriverName(int id);
		[DllImport("fmodce")]
		public static extern int FSOUND_Record_GetNumDrivers();
		[DllImport("fmodce")]
		public static extern int FSOUND_Record_GetPosition();
		[DllImport("fmodce")]
		public static extern sbyte FSOUND_Record_SetDriver(int driver);
		[DllImport("fmodce")]
		public static extern sbyte FSOUND_Record_StartSample(IntPtr FSOUND_SAMPLE_sptr, sbyte loop);
		[DllImport("fmodce")]
		public static extern sbyte FSOUND_Record_Stop();
		[DllImport("fmodce")]
		public static extern sbyte FSOUND_Reverb_SetProperties(Struct.FSOUND_REVERB_PROPERTIES prop);
		[DllImport("fmodce")]
		public static extern sbyte FSOUND_Reverb_GetProperties(Struct.FSOUND_REVERB_PROPERTIES prop);
		[DllImport("fmodce")]
		public static extern sbyte FSOUND_Reverb_SetChannelProperties(int channel,Struct.FSOUND_REVERB_PROPERTIES prop);
		[DllImport("fmodce")]
		public static extern sbyte FSOUND_Reverb_GetChannelProperties(int channel, Struct.FSOUND_REVERB_PROPERTIES prop);
		[DllImport("fmodce")]
		public static extern IntPtr FSOUND_DSPCALLBACK(ref IntPtr originalbuffer, ref  IntPtr newbuffer, int length, ref  IntPtr userdata);
		[DllImport("fmodce")]
		public static extern sbyte FSOUND_STREAMCALLBACK(IntPtr FSOUND_STREAM, ref IntPtr buff, int len, ref IntPtr userdata);
		[DllImport("fmodce")]
		public static extern IntPtr FSOUND_ALLOCCALLBACK(uint size);
		[DllImport("fmodce")]
		public static extern IntPtr FSOUND_REALLOCCALLBACK(ref IntPtr ptr, uint size);
		[DllImport("fmodce")]
		public static extern void FSOUND_FREECALLBACK(ref IntPtr ptr);
		[DllImport("fmodce")]
		public static extern IntPtr FSOUND_OPENCALLBACK(string name);
		[DllImport("fmodce")]
		public static extern void FSOUND_CLOSECALLBACK(ref IntPtr handle);
    	[DllImport("fmodce")]
		public static extern sbyte FSOUND_METADATACALLBACK(string name, string svalue, ref IntPtr FSOUND_Stream_Net_SetMetadataCallback);
		[DllImport("fmodce")]
		public static extern int FSOUND_READCALLBACK(ref IntPtr buffer, int size, ref IntPtr handle);
		[DllImport("fmodce")]
		public static extern int FSOUND_SEEKCALLBACK(ref IntPtr handle, int pos, sbyte mode);
		[DllImport("fmodce")]
		public static extern int FSOUND_TELLCALLBACK(ref IntPtr handle);
		[DllImport("fmodce")]
		public static extern sbyte FSOUND_SetPanSeperation(int pansep);
		[DllImport("fmodce")]
		public static extern void FSOUND_SetSpeakerMode(Enums.FSOUND_SPEAKERMODES speakermode);
		[DllImport("fmodce")]
		public static extern void FSOUND_Update();
	#endregion
	}
}